#!/bin/bash

CMD="./administrativedivision"
SOURCEFILE=""
PADDING=false
if [ $# -ge 1 ]; then
  SOURCEFILE=$1
fi

if [ "a$SOURCEFILE" = "a" ]; then
  echo "please type the source file(.html)"
  exit 1
fi

OUTPUT="output/`basename $SOURCEFILE|sed 's/.html//'`"

[ -d "$OUTPUT" ] || mkdir -p $OUTPUT

$CMD -source=$SOURCEFILE -format=json -padding=$PADDING > $OUTPUT/cityCode.json
$CMD -source=$SOURCEFILE -format=plist -padding=$PADDING > $OUTPUT/cityCode.plist
$CMD -source=$SOURCEFILE -format=xml -padding=$PADDING > $OUTPUT/cityCode.xml
